package com.hsmw.api.controller.forman;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hsmw.api.service.HsmwForcemanEvaluateService;
import com.hsmw.api.vo.EvaluateInfoVO;
import com.htn.common.core.base.DataResponse;
import com.htn.common.core.constant.CommonConstants;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.HsmwForcemanEvaluate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.hsmw.common.base.BaseController;

import java.util.List;

/**
 * <p>
 *  工长评价司机
 * </p>
 *
 * @author tjy
 * @since 2021-08-06
 */
@RestController
@Api(tags = "评价")
@RequestMapping("/hsmw/evaluate")
public class HsmwForcemanEvaluateController extends BaseController<HsmwForcemanEvaluateService, HsmwForcemanEvaluate> {


    @Autowired
    private HsmwForcemanEvaluateService hsmwForcemanEvaluateService;



    @ApiOperation(value = "新增 修改评价信息",notes = "新增或者修改评价信息",produces = "application/json")
    @PostMapping("saveOrUpdateEvaluate")
    public DataResponse saveOrUpdateEvaluate(@RequestBody EvaluateInfoVO vo){

        return hsmwForcemanEvaluateService.saveOrUpdateEvaluate(vo);

    }


    @ApiOperation(value = "查看评价信息",notes = "查看评价信息",produces = "application/json")
    @ApiImplicitParam(name = "id",value = "订单id",dataType = "String")
    @PostMapping("findEvaluateInfo")
    public DataResponse findEvaluateInfo(String id){

        if(StringUtils.isBlank(id)){

            return new DataResponse(CommonConstants.ResponseStatus.FAIL,"参数传递错误");

        }
        HsmwForcemanEvaluate hsmwForcemanEvaluate = hsmwForcemanEvaluateService.getOne(new LambdaQueryWrapper<HsmwForcemanEvaluate>().eq(HsmwForcemanEvaluate::getOrderId, id));
        return new DataResponse(CommonConstants.ResponseStatus.SUCCESS,hsmwForcemanEvaluate);

    }


}

